﻿@{
    Bundle("jquery_validate");
}
           
<script type="text/javascript">
    jQuery(document).ready(function() {
        jQuery('@ID("#form")').validate({
            rules: {
                accountName: {
                    required: true
                },
                quota: {
                    required: true
            }}
        });
        jQuery('@ID("#txt_account")').autocomplete({
            source: function (request, response) {
                jQuery.post('@Html.Raw(Url.Action(Loc.Act("Autocomplete").Ctrl("Account").Area("Membership")))', request, response);
            },
            minLength: 3,
            select: function(event, ui) {
                jQuery('@ID("#hidden_account")').val(ui.item.id);
            }
        });
    });
</script>
<form id="@ID("form")" action="@Url.Action(Loc.Act("Create").Ctrl("Owner"))" method="post">
    <input type="hidden" name="flags" value="None" />
    <table>
        <tr>
            <td>
                <label>@T(Res.Name("Account"))</label>
            </td>
            <td>
                <input id="@ID("hidden_account")" type="hidden" name="accountID"  />
                <input id="@ID("txt_account")" type="text" name="accountName" />
            </td>
        </tr>
        <tr>
            <td>
                <label>
                    @T(Res.Name("Quota"), JDM.String(Svc.Localization.InformationUnit.Code))
                </label>
            </td>
            <td>
                <input type="text" name="quota" value="@Svc.DataSize(Svc.Config<Decimal>(Par.In("Core").Of("FileOwnerEntity").Name("DefaultQuota")))" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.In("API").Of("Enum").Of("FileOwnerFlags").Name("Active"))</label>
            </td>
            <td>
                <input type="checkbox" name="flags" value="Active" />
            </td>
        </tr>
    </table>
    <ul class="bar toolbar">
        <li><button class="button" type="submit">@T(Res.In("Common").Of("Act").Name("Submit"))</button></li>
    </ul>
</form>